package com.crm.CLdriving.controller;

import com.crm.CLdriving.common.BaseResponse;
import com.crm.CLdriving.po.UserPO;
import com.crm.CLdriving.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("user")
@Log4j2
@Api(tags="个人信息管理")
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 获取当前Token对应的用户
     * @return
     */
    @ApiOperation("获取个人信息")
    @GetMapping("/info")
    @ResponseBody
    public BaseResponse<UserPO> getCurUser(){
        return BaseResponse.successOf(userService.getCurUser());
    }
}
